Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/227682/7/16401/19506/6616967cF7e335e48/5eddc51fac22f144.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/44729/3/26580/89888/66bc4877Fe5bab6ce/0ca16ec00a2b28f7.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/190578/10/43316/113886/6616967cF6885da2c/c89e2cd758b264ca.jpg.avif',
      'https://img12.360buyimg.com/n1/s450x450_jfs/t1/224295/33/4530/185645/6566ed58Fefec2628/2d328b03a559d009.jpg.avif',
      'https://img12.360buyimg.com/n1/s450x450_jfs/t1/231306/39/4998/45192/6566ed57F47dac137/5ab5b11f1a47ee9b.jpg.avif'
    ],


    // 商品详情介绍
    detailImg: [
      "http://img30.360buyimg.com/popWareDetail/jfs/t1/213113/10/34241/40516/64e6bfeeF12bbd55a/c25cd3a8f0223341.jpg",
      "https://img11.360buyimg.com/n1/s450x450_jfs/t1/231306/39/4998/45192/6566ed57F47dac137/5ab5b11f1a47ee9b.jpg.avif",
      "https://img11.360buyimg.com/n1/s450x450_jfs/t1/231306/39/4998/45192/6566ed57F47dac137/5ab5b11f1a47ee9b.jpg.avif",
      "https://img11.360buyimg.com/n1/s450x450_jfs/t1/190391/6/41956/46972/6566ed56Fa07b69ec/d99c6f9fc2744112.jpg.avif",
      "https://img11.360buyimg.com/n1/s450x450_jfs/t1/231046/38/5139/79320/6566ed56Fe8997c58/1089f27de0c9f5ed.jpg.avif",
      "https://img11.360buyimg.com/n1/s450x450_jfs/t1/223969/5/37221/68002/6566ed55F0e95d7d1/88eebc75738daa65.jpg.avif",
    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})
